home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / text / GapContent$InsertUndo.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  1.4 KB  |  50 lines

  1. package javax.swing.text;
  2.  
  3. import java.util.Vector;
  4. import javax.swing.undo.AbstractUndoableEdit;
  5. import javax.swing.undo.CannotRedoException;
  6. import javax.swing.undo.CannotUndoException;
  7.  
  8. class GapContent$InsertUndo extends AbstractUndoableEdit {
  9.    // $FF: synthetic field
  10.    private final GapContent this$0;
  11.    protected int offset;
  12.    protected int length;
  13.    protected String string;
  14.    protected Vector posRefs;
  15.  
  16.    protected GapContent$InsertUndo(GapContent var1, int var2, int var3) {
  17.       this.this$0 = var1;
  18.       this.offset = var2;
  19.       this.length = var3;
  20.    }
  21.  
  22.    public void redo() throws CannotRedoException {
  23.       super.redo();
  24.  
  25.       try {
  26.          this.this$0.insertString(this.offset, this.string);
  27.          this.string = null;
  28.          if (this.posRefs != null) {
  29.             this.this$0.updateUndoPositions(this.posRefs, this.offset, this.length);
  30.             this.posRefs = null;
  31.          }
  32.  
  33.       } catch (BadLocationException var1) {
  34.          throw new CannotRedoException();
  35.       }
  36.    }
  37.  
  38.    public void undo() throws CannotUndoException {
  39.       super.undo();
  40.  
  41.       try {
  42.          this.posRefs = this.this$0.getPositionsInRange((Vector)null, this.offset, this.length);
  43.          this.string = this.this$0.getString(this.offset, this.length);
  44.          this.this$0.remove(this.offset, this.length);
  45.       } catch (BadLocationException var1) {
  46.          throw new CannotUndoException();
  47.       }
  48.    }
  49. }
  50.